#batch execution wrapper
# fname = coreTask1 || coreTask2 || coreTask3
#p1 - minimum size of attributes subset
#p2 - maximum size of attributes subset

function launcher(fname,train, test, p1,p2,attr_range_begin=2,attr_range_end=8,window_widths=[0.01,0.001,0.0001])
    apriori=[];
    for(i=1:4)
        apriori(1,i)=size(test(test(:,1)==i,1),1)/size(test,1);
    end;    
    disp(apriori);
    fflush(stdout);
    #start coreTask1    
    tic();    
    for i=p1:p2
        colsets = nchoosek(attr_range_begin:attr_range_end,i);
        #iterate over possible combinations of attributes
        for j=1:size(colsets,1)
            colsets(j,:);
            #prepare lighter training and test sets
            trainset=train(:,[1,colsets(j,:)]);
            testset=test(:,[1,colsets(j,:)]);
            #launch the task #2 for each combination
            label = num2str(colsets(j,:));
            summary=["colset: ", label , " \\ errors rate: "];
            result="";            
            if(fname=="coreTask3")
                for w=1:size(window_widths,2)
                    result=feval(fname,trainset,testset,apriori,window_widths(1,w));
                    summary_ext=[summary, num2str( sum(result(2,:))/sum(result(1,:))), " \\ h1=", num2str(window_widths(1,w))];
                    disp(summary_ext);
                    fflush(stdout);
                end;
            else
                result=feval(fname,trainset,testset,apriori);  
                summary=[summary, num2str( sum(result(2,:))/sum(result(1,:)))];
                disp(summary);
            endif            
            fflush(stdout);
        end;
    end;
    toc()
end;
